# C compiler
CC = colorgcc

# Compilation flags
CFLAGS = -std=c99 -c -Wall -pedantic -O2 -g

# Linker
MATH = -lm
CURL = -lcurl

# Names
RANKER = ranker
CRAWLER = crawler

all: RANKER CRAWLER

RANKER: ranker.o digraph.o pagerank.o hits.o vector.o stats.o
	$(CC) ranker.o digraph.o pagerank.o hits.o vector.o stats.o -o $(RANKER)

CRAWLER: crawler.o parser.o hash.o
	$(CC) $(CURL) crawler.o  parser.o hash.o -o $(CRAWLER)

pagerank.o: pagerank.c pagerank.h
	$(CC) $(CFLAGS) pagerank.c

hits.o: hits.c hits.h
	$(CC) $(CFLAGS) hits.c

vector.o: vector.c vector.h
	$(CC) $(CFLAGS) vector.c

stats.o: stats.c stats.h
	$(CC) $(CFLAGS) stats.c

digraph.o: digraph.c digraph.h
	$(CC) $(CFLAGS) digraph.c

ranker.o: ranker.c
	$(CC) $(CFLAGS) $(MATH) ranker.c

crawler.o: crawler.c
	$(CC) $(CFLAGS) crawler.c

parser.o: parser.c parser.h
	$(CC) $(CFLAGS) parser.c

hash.o: hash.c hash.h
	$(CC) $(CFLAGS) hash.c

clean:
	rm -rf *.o

uninstall:
	rm -f $(RANKER) $(CRAWLER)

